package org.rooster.chromosomeevaluator;

import org.rooster.genetic.GenericRule;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * Created by IntelliJ IDEA.
 * User: manorama
 * Date: 6/5/12
 * Time: 9:20 PM
 * To change this template use File | Settings | File Templates.
 */
public class RuleEvaluator {
    
    private Set<GenericRule> ruleSet;

    public RuleEvaluator() {
        ruleSet = new HashSet<GenericRule>();
    }

    public void addRule(GenericRule genericRule) {
        ruleSet.add(genericRule);
    }
    
    public int getNoOfRules() {
        return ruleSet.size();
    }
    
    public GenericRule[] getRulesArray() {
        int i=0;
        GenericRule[] rulesArray = new GenericRule[ruleSet.size()];
        Iterator iterator = ruleSet.iterator();
        while (iterator.hasNext()) {
            rulesArray[i] = (GenericRule) iterator.next();
            i++;
        }
        return rulesArray;
    }

}
